feat(sdk,ffi): add CheckCodeSender::validate()#5957
feat(sdk,ffi): add CheckCodeSender::validate()#5957hughns wants to merge 5 commits intomatrix-org:mainfrom
CheckCodeSender::validate()#5957Conversation
…ate check code without sending the value
CheckCodeSender::validate() to allow UI to valid…CheckCodeSender::validate()
CodSpeed Performance ReportMerging #5957 will degrade performances by 39.25%Comparing Summary
Benchmarks breakdown
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5957 +/- ##
==========================================
+ Coverage 88.51% 88.52% +0.01%
==========================================
Files 363 363
Lines 103469 103480 +11
Branches 103469 103480 +11
==========================================
+ Hits 91582 91603 +21
+ Misses 7533 7522 -11
- Partials 4354 4355 +1 ☔ View full report in Codecov by Sentry. |
|
I will add some test coverage to this. |
| /// Returns `true` if the code is valid, `false` otherwise. | ||
| pub fn validate(&self, check_code: u8) -> bool { | ||
| self.inner.validate(check_code) | ||
| } |
There was a problem hiding this comment.
Why introducing a new method? The existing send could fail fast if the code is not correct after a local check.
There was a problem hiding this comment.
Actually it's probably not a good idea to never send the code. So maybe add a parameter to the send method like validate: Boolean?
This is quite equivalent, so feel free to ignore my comments ;)
The purpose of this is to allow the UI to validate the entered check code and provide user with the ability to retry entering the code.
The existing
send()function is one shot and does not allow for retries.This is for use in a scenario where the user has mistyped the code rather than where a MITM attack has been detected.
I'm not wedded to the
validate()name, so if something else is preferable I can change it.Signed-off-by: Hugh Nimmo-Smith hughns@element.io